package com.example.testelc.config;

import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.elasticsearch.client.ClientConfiguration;
import org.springframework.data.elasticsearch.client.RestClients;

/**
 * @Author: 普发忠
 * @Date: 2021/11/05/15:28
 */
@Configuration
public class ElcConfig {
    
    @Bean
    public RestHighLevelClient restHighLevelClient(){
        ClientConfiguration build = ClientConfiguration.builder().connectedTo("127.0.0.1:9200").build();
        return RestClients.create(build).rest();
    }
}
